package com.xubeihong.xubeihong.demo;

import com.xubeihong.xubeihong.TicketTask;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.*;

@Slf4j
@Component
public class DemoRun {

    ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(3);
    TicketTask task = new TicketTask();

    //@Scheduled(cron = "59 59 9 * * ?")
    @Scheduled(cron = "59 46 13 * * ?")
    public int getTicket() throws ExecutionException, InterruptedException {
        //System.out.println(new Date()+"执行");
        scheduler.scheduleAtFixedRate(task,0,1500, TimeUnit.MILLISECONDS);
        return 0;
    }
}
